﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace WcfServiceHosted
{
	[ServiceContract(CallbackContract = typeof(IMyDuplexCallback))]
	public interface IMyDuplexService
	{
		[OperationContract(IsOneWay = true)]
		void Join(string userId);

		[OperationContract(IsOneWay = true)]
		void Leave(string userId);

		[OperationContract(IsOneWay = true)]
		void SendMessage(string userId, string message);
	}

	public interface IMyDuplexCallback
	{
		[OperationContract(IsOneWay = true)]
		void OnCallback(string message);
	}

	[DataContract(Name = "UserMessage", Namespace = "www.WcfDuplex.net")]
	public class UserMessage
	{
		[DataMember(Order = 1)]
		public string UserId
		{
			get;
			set;
		}

		[DataMember(Order = 2)]
		public string MessageBody
		{
			get;
			set;
		}
	}
}
